const fs = require('fs');
const WXPay = require('weixin-pay');
const wxpay = WXPay({
    appid: think.config('xcx.appid'),
    mch_id: think.config('payment.mch_id'),
    partner_key: think.config('payment.partner_key')
});
module.exports = class extends think.Service {
    xcx_order(data) {
        return new Promise(resolve => {
            wxpay.getBrandWCPayRequestParams({
                openid: think.user.openid,
                body: '服装私人定制',
                detail: '服装私人定制',
                out_trade_no: data.out_trade_no,
                total_fee: Math.floor(Number(data.order_pirce) * 100),
                spbill_create_ip: '1.116.160.28',
                notify_url: think.config('payment.notify_url')
            }, function(err, result) {
                
                console.log(result);
                resolve(result);
            });
        });
    }
};
